﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using DBUtil;
using ZXCompany.Models.Entity;
namespace ZXCompany.Models.Dao
{
    public class ZX_ServiceFlowDao
    {
        private Database db = new Database();

        /// <summary>
        /// 获取差别化信息
        /// </summary>
        /// <param name="sconn"></param>
        /// <returns></returns>
        public ZX_ServiceFlow Select(SqlConnection sconn)
        {
            try
            {
                string sql = @"SELECT isnull([ID],0) as ID
                                      ,isnull([serviceFlow],'') as [serviceFlow]
                                      ,isnull([addUserID],0) as addUserID
                                      ,isnull([addTime],'') as [addTime]
                                      ,isnull([updateTime],'') as [updateTime]
                                  FROM [ZX_ServiceFlow]";
                DataTable dt = db.Squery(sql, sconn);
                ZX_ServiceFlow zd = new ZX_ServiceFlow();
                if (dt != null && dt.Rows.Count > 0)
                {
                    zd.addTime = dt.Rows[0]["addTime"].ToString();
                    zd.addUserID = Convert.ToInt32(dt.Rows[0]["addUserID"]);
                    zd.serviceFlow = dt.Rows[0]["serviceFlow"].ToString();
                    zd.ID = Convert.ToInt32(dt.Rows[0]["ID"]);
                    zd.updateTime = dt.Rows[0]["updateTime"].ToString();
                }
                return zd;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}